﻿@inherits LayoutComponentBase
@layout EmptyLayout
@inject IOptions<BuildStatus> BuildStatus
@inject IBlogService Service

<Link rel="icon" href="@BlogOptions.Icon" />

<AntDesign.Layout Style="min-height: 100vh; background: initial">
    <Sider Collapsible Theme="SiderTheme.Light" Breakpoint="BreakpointType.Xl" CollapsedWidth="0">
        <Menu Mode="MenuMode.Inline" Theme="MenuTheme.Light">
            <MenuItem Class="text-center p-0">
                @BlogOptions.Name
            </MenuItem>
            <MenuItem>
                <MdiIcon Type="@IconNames.Home" />
                <span>
                    <MenuLink href="" Match="NavLinkMatch.All">
                        Home
                    </MenuLink>
                </span>
            </MenuItem>
            <SubMenu>
                <TitleTemplate>
                    <span>
                        <MdiIcon Type="@IconNames.Posts" />
                        <span>
                            <MenuLink href="posts">
                                Posts
                            </MenuLink>
                        </span>
                    </span>
                </TitleTemplate>
                <ChildContent>
                    <MenuItem>
                        <MdiIcon Type="@IconNames.Articles" />
                        <span>
                            <MenuLink href="articles">
                                Articles
                            </MenuLink>
                        </span>
                    </MenuItem>
                    <MenuItem>
                        <MdiIcon Type="@IconNames.Slides" />
                        <span>
                            <MenuLink href="slides">
                                Slides
                            </MenuLink>
                        </span>
                    </MenuItem>
                    <MenuItem>
                        <MdiIcon Type="@IconNames.Notes" />
                        <span>
                            <MenuLink href="notes">
                                Notes
                            </MenuLink>
                        </span>
                    </MenuItem>
                </ChildContent>
            </SubMenu>
            <MenuItem>
                <MdiIcon Type="@IconNames.Category" />
                <span>
                    <MenuLink href="categories">
                        Categories
                    </MenuLink>
                </span>
            </MenuItem>
            <MenuItem>
                <MdiIcon Type="@IconNames.Keywords" />
                <span>
                    <MenuLink href="keywords">
                        Keywords
                    </MenuLink>
                </span>
            </MenuItem>
            <MenuItem>
                <MdiIcon Type="@IconNames.Archive" />
                <span>
                    <MenuLink href="archives">
                        Archives
                    </MenuLink>
                </span>
            </MenuItem>
            <MenuItem>
                <MdiIcon Type="@IconNames.Comment" />
                <span>
                    <MenuLink href="comments">
                        Comments
                    </MenuLink>
                </span>
            </MenuItem>
            <MenuItem>
                <MdiIcon Type="@IconNames.Search" />
                <span>
                    <MenuLink href="search">
                        Search
                    </MenuLink>
                </span>
            </MenuItem>
            <MenuItem>
                <MdiIcon Type="@IconNames.Settings" />
                <span>
                    <MenuLink href="settings">
                        Settings
                    </MenuLink>
                </span>
            </MenuItem>
        </Menu>
    </Sider>
    <AntDesign.Layout Style="background: initial;">
        <Content>@Body</Content>
        <Footer Class="text-center p-1">
            <MdiIcon Type="copyright" />
            @BlogOptions.StartYear - @DateTimeOffset.Now.Year, @(BlogOptions.Onwer). All rights reserved.
            @if (!string.IsNullOrEmpty(BlogOptions.Footer))
            {
                @((MarkupString)BlogOptions.Footer)
            }
            Powered by
            <Popover Content="AcBlogInfo" Title="@($"AcBlog v{BuildStatus.Value.Version}")">
                <ContentTemplate>
                    <div>
                        Repository: <a href="https://github.com/@BuildStatus.Value.Repository">@BuildStatus.Value.Repository</a>
                        <br />
                        Commit: <a href="https://github.com/@BuildStatus.Value.Repository/commit/@BuildStatus.Value.Commit">@BuildStatus.Value.TrimedCommit</a>
                        <br />
                        Branch: <a href="https://github.com/@BuildStatus.Value.Repository/tree/@BuildStatus.Value.Branch">@BuildStatus.Value.TrimedBranch</a>
                        <br />
                        Version: @BuildStatus.Value.Version
                        <br />
                        Built Date: @BuildStatus.Value.BuildDate
                    </div>
                </ContentTemplate>
                <ChildContent>
                    <a href="https://github.com/acblog/acblog">AcBlog</a>
                </ChildContent>
            </Popover>
        </Footer>
    </AntDesign.Layout>
</AntDesign.Layout>

<BackTop></BackTop>

@code {
    private BlogOptions BlogOptions { get; set; } = new BlogOptions();

    protected override async Task OnInitializedAsync()
    {
        BlogOptions = await Service.GetOptions();
        await base.OnInitializedAsync();
    }
}